%%
%% This is file `qqz.sty'.  It handles the latex portions of extracting
%%	Quick Quizzes.  Other pieces of the puzzle may be found
%%	in the Makefile and the utilities directory.
%%
%% \QuickQuizChapter{chp:label} -- to introduce a chapter with quick quizzes.
%% \QuickQuiz{}
%%	Question goes here.
%% \QuickQuizAnswer{
%%	Answer goes here.
%% } \QuickQuizEnd
%% \QuickQuizAnswers -- to dump out all questions and answers in new section.
%%
%% Copyright (C) IBM Corporation, 2008
%%
%% Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

\newcounter{quickquizctr}
\newcommand{\QuickQuizAnswerChapter}{\textbf{Unknown QuickQAC!!!}}

\newcommand{\QuickQuizChapter}[2]{
	\chapter{#2}
	\label{#1}
	\setcounter{quickquizctr}{0}}
\newcommand{\QuickQuiz}[1]{
	\refstepcounter{quickquizctr}
	\textbf{Quick Quiz \thechapter.\thequickquizctr:}}
\newcommand{\QuickQuizAnswer}[1]{\rule{7pt}{7pt}}
\newcommand{\QuickQuizEnd}{}

\newcommand{\QuickQuizAnswers}{
	\chapter{Answers to Quick Quizzes}
	\label{chp:Answers to Quick Quizzes}
	~ \\
	\input{qqz}}

%% Internal interfaces generated by scripts.

\newcommand{\QuickQAC}[2]{
	\renewcommand{\QuickQuizAnswerChapter}{\ref{#1}}
	\setcounter{quickquizctr}{0}
	\section{#2}}

\newcommand{\QuickQ}[1]{
	\refstepcounter{quickquizctr} ~ \\ ~ \\
	\textbf{Quick Quiz \QuickQuizAnswerChapter.\thequickquizctr:} #1 ~ \\ }

\newcommand{\QuickA}[1]{\rule{7pt}{7pt} \\ ~ \\ \textbf{Answer:} \\ }
